<template>
    <input type="text" v-model="name">
    {{name}}
</template>

<script>
    import {toRef} from 'vue'
    export default {
        name : "Demo",
        setup(){
            const person = {
                name:'zhangsan',
                age:18,
            }
            //改name不会变化
            // const name = person.name
            // 用toRef包裹成Proxy实例对象，可以检测改变
            const name = toRef(person,name)

            return {name}
        },
    }
</script>

<style scoped>

</style>